using System;
using System.Collections.Generic;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class MainUi : MonoBehaviour
{

    //公开进入游戏的按键
    public Button enterGameButton;
    public Button quitButton;
    public Button backButton;
    public Button setButton;
    public Button sliderBackButton;
    public Button overGameBackButton;

    public Button tuCaoBackButton;
    public Button tuCaoButton;
    
    //公开的面板
    public GameObject gamePanel;

    public GameObject mainPanel;
    public GameObject sliderPanel;
    public GameObject overPanel;
    public GameObject tuCaoPanel;
    
    void Start()
    {
        enterGameButton.onClick.AddListener(EnterGame);
        quitButton.onClick.AddListener(Quit);
        backButton.onClick.AddListener(BackButton);
        overGameBackButton.onClick.AddListener(OverGame);
        tuCaoButton.onClick.AddListener(TuCao);
        tuCaoBackButton.onClick.AddListener(TuCaoBack);
        
        setButton.onClick.AddListener(SetButton);
        sliderBackButton.onClick.AddListener(SliderBack);
        
    }

    public void EnterGame()
    {
        AudioManage.instance.PlayButtonAudio();

        gamePanel.SetActive(true);
        mainPanel.SetActive(false);
    }

    public void SetButton()
    {

        AudioManage.instance.PlayButtonAudio();
        
        sliderPanel.SetActive(true);
    }

    public void SliderBack()
    {
        AudioManage.instance.PlayButtonAudio();

        sliderPanel.SetActive(false);
    }

    public void BackButton()
    {
        AudioManage.instance.PlayButtonAudio();
        mainPanel.SetActive(true);
        gamePanel.SetActive(false);

    }


    //退出方法
    public void Quit()
    {
        AudioManage.instance.PlayButtonAudio();
        Application.Quit();
    }

    public void OverGame()
    {
        AudioManage.instance.PlayButtonAudio();
        overPanel.SetActive(false);
    }

    public void TuCao()
    {
        AudioManage.instance.PlayButtonAudio();
        tuCaoPanel.SetActive(true);
    }

    public void TuCaoBack()
    {
        AudioManage.instance.PlayButtonAudio();
        tuCaoPanel.SetActive(false);
    }
}
